const person = {
  name: 'zhangsan',
  age: 23
}
const p = new Proxy(person,{
  get(target,property){
    //return target[property]
    //可以对返回值进行数据劫持
    return 100
  },
  set(target,property,newVal){
    //target[property] = newVal
    //对新值数据劫持，验证数据合法性
    if(property === 'age') {
      if(!Number.isInteger(newVal)){
        throw new TypeError(`${newVal} is not a int`)
      }
    }
  }
})
console.log(p.name)
p.age = '123'